/****************************************************************
 * Copyright (c), 2025, Shanghai Daimay Automotive Parts Co.,Ltd.
 * @file:    SystemTimer.h
 * @author:  Garry Meng
 * @version: V1.0.0  
 * @date:    2025-06-17
 * @brief:   system timer management
****************************************************************/

#ifndef __SYSTEM_TIMER_H__
#define __SYSTEM_TIMER_H__

#include<stdint.h>

#define TIMER_LENGTH    32u /*define timer length,should only can be 8u/16u/32u*/

#if TIMER_LENGTH==8u
typedef uint8_t    SYS_TIMER_TYPE_t;
#define SYSTEM_TIMER_MAX  UINT8_MAX

#elif TIMER_LENGTH==16u
typedef uint16_t    SYS_TIMER_TYPE_t;
#define SYSTEM_TIMER_MAX  UINT16_MAX

#elif TIMER_LENGTH==32u
typedef uint32_t    SYS_TIMER_TYPE_t;
#define SYSTEM_TIMER_MAX  UINT32_MAX

#else //default use 16 bit timer
typedef uint16_t    SYS_TIMER_TYPE_t;
#define SYSTEM_TIMER_MAX  UINT16_MAX

#endif



void SystemTimer_init(void);
SYS_TIMER_TYPE_t SystemTimer_GetTimeValue(void);
SYS_TIMER_TYPE_t SystemTimer_GetTimeDelta(SYS_TIMER_TYPE_t lastCount);
void SystemTimer_callback( void );


#endif // __SYSTEM_TIMER_H__

